﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ERF;
using Microsoft.Xna.Framework;
using FirstPerson.Objects.Pickups;
using ERF.Physics;
using Microsoft.Xna.Framework.Audio;

namespace FirstPerson.Objects.Pickups
{
    class Healthpack : Pickable
    {
        public Healthpack(ERFGame game) : base(game, @"Models\healthpack2") {
            base.Scale = Vector3.One * 0.3f;

            base.mySound = game.Content.Load<SoundEffect>("Sounds\\sndHealth");
            this.spawnTime = 10f;
            this.Picked += new EventHandler<PickedEventArgs>(Healthpack_Picked);
        }

        protected override void CreateBody()
        {
            BoundingBox box = new BoundingBox(
                new Vector3(-0.5f, 0f, -0.5f),
                new Vector3(0.5f, 1f, 0.5f));

            this.body = new Body(Vector3.Zero, box, 0, 0, false, this.mass, this);
            this.body.BodyChanged += new EventHandler(body_BodyChanged);
        }

        private void Healthpack_Picked(object sender, PickedEventArgs e)
        {
            e.Player.Hp += 25;
            base.Play3DSound(mySound);
            if (e.Player.Hp > 100)
                e.Player.Hp = 100;
        }

        public override void DrawSolid(GameTime gameTime)
        {
            base.DrawSolid(gameTime);
        }

        
    }
}
